<template>
  <a-card :bordered="false">
    <!-- 查询区域-END -->

    <!-- 操作按钮区域 -->
    <div class="table-operator" >
      <a-button @click="routerBaack" type="primary" >返回</a-button>
      <!--wjn 添加农机按钮      -->
      <a-button @click="handleAdd()" type="primary" icon="plus">添加农机</a-button>
    </div>

    <!-- table区域-begin -->
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div>

      <a-table
        ref="table"
        size="middle"
        :scroll="{x:true}"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        class="j-table-force-nowrap"
        @change="handleTableChange">
        <!-- <div slot="time" >{{e}}</div> -->
        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)">修改日期</a>
          <a-divider type="vertical" />
          <!-- wjn 修改更多   -->
          <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">           
            <a>删除</a>
          </a-popconfirm>
        </span>
      </a-table>
    </div>

    <axhk-yw-agrplane-modal-fly ref="modalForm" @ok="modalFormOk"></axhk-yw-agrplane-modal-fly>
  </a-card>
</template>

<script>
  import { httpAction, getAction } from '@/api/manage'
  import '@/assets/less/TableExpand.less'
  import { mixinDevice } from '@/utils/mixin'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import AxhkYwAgrplaneModalFly from './modules/AxhkYwAgrplaneModalFly'
  import JDictSelectTag from '@/components/dict/JDictSelectTag.vue'
  import JSuperQuery from '@/components/jeecg/JSuperQuery.vue'

  export default {
    name: 'Fly',
    mixins:[JeecgListMixin, mixinDevice],
    components: {
      JDictSelectTag,
      AxhkYwAgrplaneModalFly,
      JSuperQuery,
    },
    data () {
      return {
        description: '无人机管理表管理页面',
        // 表头
        columns: [
          {
            title: '#',
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            }
          },
          {
            title:'无人机序列号',
            align:"center",
            dataIndex: 'serial_number'
          },
          {
            title:'运营人',
            align:"center",
            dataIndex: 'operator'
          },
          {
            title:'制造商标识',
            align:"center",
            dataIndex: 'sign'
          },
          {
            title:'数据开放日期',
            align:"center",
            dataIndex: 'time',
            // sorter: true,
            scopedSlots: { customRender: 'time' },
            // customRender:function (text) {
            //   return !text?"":(text.length>10?text.substr(0,10):text)
            // }
          },
          {
            title:'已作业(亩)',
            align:"center",
            dataIndex: 'total_area'
          },
          {
            title:'状态',
            align:"center",
            dataIndex: 'latch_dictText'
          },
          {
            title: '操作',
            dataIndex: 'action',
            align:"center",
            fixed:"right",
            width:147,
            scopedSlots: { customRender: 'action' }
          }
        ],
        url: {
          list: "/fly/axhkWorkManagement/workId",
          delete: "/fly/axhkWorkManagement/getByPlaneId",
        },
        dictOptions:{},
        superFieldList:[],
        dataSource:[],
        e:'',
      }
    },
    created() {     
    this.loadData(); 
      // this. modalFormOk();   
    },
    mounted(){ 
         
    },
    methods: {
      // modalFormOk(e){
      //   this.e=e;
      //     // alert(JSON.stringify(this.e))
      // },
      // handleAdd(){
      //   this.$refs.modalForm.add(this.$route.query.id);
      // } ,    
      loadData(){
        let id=this.$route.query.id;
        // alert(id);
        // alert(123);
        // console.log(e)
        getAction(this.url.list,{id:this.$route.query.id}).then((res)=>{
            //  alert(JSON.stringify(formData.startWork))
            if(res.success){
            this.dataSource =res.result;            
            }
          });
      },
      routerBaack(){
        this.$router.back()
      }
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>